import org.junit.Test;
import play.mvc.Http;
import play.test.FunctionalTest;

import java.io.UnsupportedEncodingException;

public class UserCases extends FunctionalTest {
    @Test
    public void home() throws UnsupportedEncodingException {
        Http.Response response = GET("/");
        assertContentMatch("Музыкальный интернет магазин", response);
    }

    @Test
    public void categoryList() {
        Http.Response response = GET("/category/list");
        assertContentMatch("DigitalBand.ru - Каталог", response);
    }

    @Test
    public void categoryFilteredProductList() {
        Http.Response response = GET("/category/3/products");
        assertContentMatch("DigitalBand.ru - Список товаров", response);
    }

    @Test
    public void brandAndCategoryFilteredProductList() {
        Http.Response response = GET("/category/3/products?brandId=1");
        assertContentMatch("DigitalBand.ru - Список товаров", response);
    }

    @Test
    public void pagerTest(){
        Http.Response response = GET("/category/3/products/2?brandId=1");
        assertContentMatch("DigitalBand.ru - Список товаров", response);
        response = GET("/category/3/products/3?brandId=1");
        assertContentMatch("DigitalBand.ru - Список товаров", response);
    }

    @Test
    public void productPage() {
        Http.Response response = GET("/product/1");
        assertContentMatch("DigitalBand.ru - IBANEZ GRX40 BLACK NIGHT", response);
    }

    @Test
    public void gallery(){
        Http.Response response = GET("/product/1777/gallery/1");
        assertContentMatch("DigitalBand.ru - Фото", response);
    }
}
